package com.yangxk.kadmin.auth.beans;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class TableBean {
    private static final String USER_ROLE_TABLENAME = "sys_user_role";
    private static final String USER_ROLE_USERID = "user_id";
    private static final String USER_ROLE_ROLEID = "role_id";
    private static final String ROLE_AUTH_TABLENAME = "sys_role_auth";
    private static final String ROLE_AUTH_ROLEID = "role_id";
    private static final String ROLE_AUTH_AUTHID = "auth_id";
    private static final String AUTH_TABLENAME = "sys_auth";
    private static final String AUTH_IDNAME = "id";
    private static final String AUTH_URLNAME = "url";
    private static final boolean AUTH_USESTATUS = false;

    /**
     * 用户角色中间表信息
     */
    private UserRoleInfo userRole = new UserRoleInfo();
    /**
     * 角色权限中间表信息
     */
    private RoleAuthInfo roleAuth = new RoleAuthInfo();
    /**
     * 权限表信息
     */
    private AuthInfo auth = new AuthInfo();

    @Getter
    public static class UserRoleInfo {
        String tableName = USER_ROLE_TABLENAME;
        String userIdName = USER_ROLE_USERID;
        String roleIdName = USER_ROLE_ROLEID;

        public UserRoleInfo setTableName(String tableName) {
            this.tableName = tableName;
            return this;
        }

        public UserRoleInfo setUserIdName(String userIdName) {
            this.userIdName = userIdName;
            return this;
        }

        public UserRoleInfo setRoleIdName(String roleIdName) {
            this.roleIdName = roleIdName;
            return this;
        }
    }

    @Getter
    public static class RoleAuthInfo {
        String tableName = ROLE_AUTH_TABLENAME;
        String roleIdName = ROLE_AUTH_ROLEID;
        String authIdName = ROLE_AUTH_AUTHID;

        public RoleAuthInfo setTableName(String tableName) {
            this.tableName = tableName;
            return this;
        }

        public RoleAuthInfo setRoleIdName(String roleIdName) {
            this.roleIdName = roleIdName;
            return this;
        }

        public RoleAuthInfo setAuthIdName(String authIdName) {
            this.authIdName = authIdName;
            return this;
        }
    }

    @Getter
    public static class AuthInfo {
        String tableName = AUTH_TABLENAME;
        String idName = AUTH_IDNAME;
        String urlName = AUTH_URLNAME;
        boolean useStatus = AUTH_USESTATUS;
        String statusWhere;

        public AuthInfo setTableName(String tableName) {
            this.tableName = tableName;
            return this;
        }

        public AuthInfo setIdName(String idName) {
            this.idName = idName;
            return this;
        }

        public AuthInfo setUrlName(String urlName) {
            this.urlName = urlName;
            return this;
        }

        public AuthInfo setUseStatus(boolean useStatus) {
            this.useStatus = useStatus;
            return this;
        }

        public AuthInfo setStatusWhere(String statusWhere) {
            this.statusWhere = statusWhere;
            return this;
        }
    }
}
